<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>安全帽和人员检测</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
    <link rel="icon" href="{{ url_for('static', filename='images/logo.ico') }}" type="image/x-icon">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
</head>
<body>
 <div class="wave-bg"></div>
    <div class="container">
        <div class="row justify-content-center mt-5">
            <div class="col-md-8">
                <div class="card shadow">
                    <div class="card-header bg-primary text-white">
                        <h3 class="text-center">安全帽和人员检测</h3>
                    </div>
                    <div class="card-body">
                        <div class="mb-4 text-center">
                            <p class="lead">上传图片以检测安全帽和人员</p>
                        </div>

                        <div class="upload-section">
                            <form id="uploadForm" enctype="multipart/form-data">
                                 <!-- 修改上传区域为拖拽上传 -->
                                <div class="upload-area" id="uploadArea">
                                    <div class="upload-instruction">
                                        <i class="fas fa-cloud-upload-alt fa-3x mb-3"></i>
                                        <p class="mb-1">点击选择或拖拽图片至此</p>
                                        <p class="text-muted">支持格式: JPG, PNG</p>
                                    </div>
                                    <input type="file" class="form-control" id="imageUpload" name="file" accept="image/*" required>
                                </div>
                                <div class="d-grid">
                                    <button type="submit" class="btn btn-primary">检测</button>
                                </div>
                            </form>
                            <div class="mt-3 text-center">
                                <img id="previewImage" src="" class="img-fluid" alt="预览图片" style="max-height: 300px; display: none;">
                            </div>
                        </div>

                        <div id="loadingSpinner" class="text-center" style="display: none;">
                            <div class="spinner-border text-primary" role="status">
                                <span class="visually-hidden">Loading...</span>
                            </div>
                            <p class="mt-2">检测中，请稍候...</p>
                        </div>

                        <div id="resultSection" class="mt-4" style="display: none;">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="card">
                                        <div class="card-header text-center">
                                            原始图片
                                        </div>
                                        <div class="card-body">
                                            <img id="originalImage" src="" class="img-fluid" alt="原始图片" style="max-width: 100%; height: auto; display: block; margin: 0 auto;">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="card">
                                        <div class="card-header text-center">
                                            检测结果
                                        </div>
                                        <div class="card-body">
                                            <img id="detectedImage" src=""alt="检测结果" style="max-width: 100%; height: auto; display: block; margin: 0 auto;">
                                            <div id="detectionsList" class="mt-3">
                                                <!-- 检测结果将显示在这里 -->
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="{{ url_for('static', filename='js/script.js') }}"></script>
</body>
</html>